class Solution {
public:
	vector<int> countBits(int num) {
		int count = 0;
		vector<int> vec;
		int spiling = 1;
		int temp = 0;
		vec.push_back(0);
		vec.push_back(1);
		for (size_t i = 2; i <= num; i++)
		{
			if (i == (int)pow(2 , spiling)) {
				vec.push_back(1);
			}
			else if(i == (int)pow(2, spiling+1))
			{
				vec.push_back(1);
				spiling++;
			}
			else
			{
				vec.push_back(1 + vec[i- pow(2, spiling)]);
			}
		}
		return vec;
	}
};